package com.sunny.design.prototype.deep.json;

import com.alibaba.fastjson.JSON;

import java.util.Arrays;
import java.util.List;

/**
 * @author Sunny
 * @date 2020/3/1
 */
public class JsonDeepTest {
    public static void main(String[] args) {
        Person person = new Person();
        person.setAge(25);
        person.setName("Sunny");
        List<String> hobbies = Arrays.asList("Swim", "Game");
        person.setHobbies(hobbies);

        String json = JSON.toJSONString(person);
        Person person1 = JSON.parseObject(json, Person.class);
        List<String> hobbies1 = person1.getHobbies();
        hobbies1.add("Java");

        System.out.println(person);
        System.out.println(person1);
        System.out.println(person == person1);

        System.out.println(hobbies);
        System.out.println(hobbies1);
        System.out.println(hobbies == hobbies1);
    }
}
